package com.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(tags = "用户管理")
public class UserController {
 
    @Value("${server.port}")
    private int port;

 
    @GetMapping("/userInfo")
    public String userInfo() {
        log.info("user ok!  port={}", port);
        return "user ok! port=" + port;
    }

    @ApiOperation(value = "权限接口调用")
    @Secured("ROLE_ADMIN")
    @GetMapping("/findAll")
    public String findAll() {
        log.info("findAll 调用");
        return "findAll 调用";
    }

    @ApiOperation(value = "无权限接口调用")
    @GetMapping("/findAllNoPer")
    public String findAllNoPer() {
        log.info("findAll 无权限调用");
        return "findAll 无权限调用";
    }

}